package com.controller;

import com.pojo.ResponsePojo;
import com.service.GoodsService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.PathVariable;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;

@RestController
@RequestMapping("/goods")
public class GoodsController {
    private GoodsService goodsService;
    @Autowired
    public void setGoodsService(GoodsService goodsService) {
        this.goodsService = goodsService;
    }

    @GetMapping("/findNew")
    public ResponsePojo findNew(){
        return goodsService.findNewGoods();
    }

    @GetMapping("/findHot")
    public ResponsePojo findHot(){
        return goodsService.findHot();
    }

    @GetMapping("/details/{id}")
    public ResponsePojo findById(@PathVariable int id){
        return goodsService.findById(id);
    }
}
